<template>
  <div class="order-detail">
    <n-descriptions label-placement="left" title="">
      <n-descriptions-item label="订单编号"> {{ order.orderSn }} </n-descriptions-item>
      <n-descriptions-item label="下单时间">
        {{ formatToDateTime(order.createTime * 1000) }}
      </n-descriptions-item>
      <n-descriptions-item label="商品数量"> {{ order.goodsNum }} </n-descriptions-item>
      <!-- <n-descriptions-item label="折扣金额"> {{ order.discountPrice }} </n-descriptions-item> -->
      <n-descriptions-item label="订单价格">
        {{ order.goodsPrice.toFixed(2) }}
      </n-descriptions-item>
      <n-descriptions-item label="订单状态">
        {{ getOrderStatus(order.orderStatus) }}
      </n-descriptions-item>
      <n-descriptions-item label="会员名称"> {{ order.memberName }} </n-descriptions-item>
      <n-descriptions-item label="收货人"> {{ order.shipName }} </n-descriptions-item>
      <n-descriptions-item label="联系电话"> {{ order.shipMobile }} </n-descriptions-item>
      <n-descriptions-item label="完成时间" v-if="order.completeTime">
        {{ order.completeTime ? formatToDateTime(order.completeTime * 1000) : '' }}
      </n-descriptions-item>
      <n-descriptions-item label="收货地址">
        {{ `${order.shipAreaName}-${order.shipFullAddress}` }}
      </n-descriptions-item>
      <n-descriptions-item label="支付时间">
        {{ order.paymentTime ? formatToDateTime(order.paymentTime * 1000) : '' }}
      </n-descriptions-item>
    </n-descriptions>
  </div>
</template>
<script setup lang="ts">
  import { formatToDateTime } from '@/utils/dateUtil';
  import { type Order } from './entity/Order';
  import { getOrderStatus } from './enum/OrderEnum';
  interface Props {
    order: Order; // 订单对象
  }
  const props = withDefaults(defineProps<Props>(), {});
</script>

<style scoped></style>
